import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    children:[{
      path:'/dianCan',
      component:()=>import('../views/dingCan.vue')
    },
    {
      path:"/pingJia",
      component:()=>import('../views/pingJia.vue')
    },
    {
      path:"/shangJia",
      component:()=>import('../views/shangJia.vue')
    }
  ], redirect: '/dianCan'
  },
  {
    path: "/geRen",
   
    component: () => import("../views/GeRen.vue")
  },
  {
    path:"/search",
    name:'Search',
    component:()=>import("../views/Search.vue")
  },
  {
    path:'/dingDan',
    component:()=>import('../views/dingDan.vue')
  },
  {
    path:'/login',
    component:()=>import("../views/Login.vue"),
   
  },
  {
    path:'/register',
    name:'注册页',
    component:()=>import('../views/Register.vue')
  },
  {
    path:'/honBao',
    component:()=>import('../views/HonBao.vue')
  },
  {
    path:'/ziLiao',
    component:()=>import('../views/ZiLiao.vue')
  },
  {
    path:'/fenLei',
    component:()=>import('../views/FenLei.vue')
  },
  {
    path:'/dinDan',
    component:()=>import('../views/dingDan.vue')
  },
  {
    path:'/xiangQing',
    name:'详情',
    component:()=>import('../views/XiangQing.vue')
  },
  {
    path:'/tuiJian',
    name:'推荐',
    component:()=>import('../views/tuiJian.vue')
  },
  {
    path:'/trueDing',
    name:'提交订单',
    component:()=>import('../views/trueDing.vue')
  },
  {
    path:'/shouYin',
    name:'收银',
    component:()=>import('../views/shouYin.vue')
  },
  {
    path:'/addressList',
    name:'地址列表',
    component:()=>import('../views/addressList.vue')
  },
  {
    path:"/addDzhi",
    name:'新增地址',
    component:()=>import('../views/addDzhi.vue')
  },
  {
    path:'/userPing',
    name:'用户评价',
    component:()=>import("../views/userPing.vue")
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
export default router
